<?php


namespace plugin\agent\app\admin\logic;


use app\common\logic\BaseLogic;
use plugin\agent\app\model\AgentWithdrawal;

class AgentWithdrawalLogic extends BaseLogic
{
    public function __construct()
    {
        $this->model = new AgentWithdrawal();
    }

    public function agree($input)
    {
        $this->model->where([
            "status" => AgentWithdrawal::STATUS_WAIT,
            "id" => $input['id'],
        ])->update([
            "status" => AgentWithdrawal::STATUS_AGREE,
            "desc" => $input['desc'],
        ]);

        //todo::执行提现到余额或者提现到银行卡

    }

    public function refuse($input)
    {
        $this->model->where([
            "status" => AgentWithdrawal::STATUS_WAIT,
            "id" => $input['id'],
        ])->update([
            "status" => AgentWithdrawal::STATUS_REFUSE,
            "refuse_reason" => $input['refuse_reason'],
        ]);
    }
}